import { IChatItem } from '@src/types/chat';
import { makeReducers } from '../utils';
import { createSlice } from '@reduxjs/toolkit';

// 初始值
const initialState = {
  chatId: '', // 当前的会话id
  curChatItem: {} as IChatItem, // 当前会话信息
  isFetching: false, // 当前是否正在获取答案中
};

// chatSlice
export const chatSlice = createSlice({
  name: 'chat',
  initialState,
  reducers: makeReducers(initialState),
});

export const { actions: chatActions, reducer: chatReducer } = chatSlice;
